{extend name="public:base" /}
{block name="head"}
<link href="__PUBLIC__/view_res/mobile/css/wshop_company_center.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/lib/weui.min.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/view_res/mobile/css/login.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/lib/weui.min.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/css/jquery-weui.min.css" type="text/css" rel="Stylesheet" />
<script src="__PUBLIC__/jquery-weui/dist/js/jquery-weui.min.js"></script>
<link href="__PUBLIC__/view_res/mobile/css/uc.css" type="text/css" rel="Stylesheet" />

{/block} 
{block name="header"}
{include file="public/top-nav" /}
{/block}

{block name="content"}
    <style>
        body{
            background:none;
        }
    </style>
    <header class="Thead">提取现货</header>

    {:token()}

    <div style="margin:0 10px;">
         产品名称：{$goods.name}
         <p>
         使用提货克数：{$goods.pay_points}
         <p>
         我的可用提货克数：{$av_num}
         <p>
         产品所需加工费：{$goods.price}
    </div>

    <div style="margin:0 10px;">
        <div class="gs-text">
            <input type="number" name="num" value=""  tabindex="2" placeholder="请输入产品的数量" autocomplete="off"/>

            <input type="hidden" name="goods_id" id="goods_id" value="{$goods.goods_id}"  tabindex="2" autocomplete="off"/>
        </div>
    </div>
    <div style="margin:0 10px;">
        <div class="gs-text">
            <input type="text" name="address" id="address"  value=""  tabindex="2" placeholder="请输入收货地址" autocomplete="off"/>
        </div>
    </div>
    <div style="margin:0 10px;">
        <div class="gs-text">
            <input type="text" name="accuser" id="accuser"  value=""  tabindex="2" placeholder="收货人" autocomplete="off"/>
        </div>
    </div>
    <div style="margin:0 10px;">
        <div class="gs-text">
            <input type="text" name="accmobile" id="accmobile"  value=""  tabindex="2" placeholder="收货人电话" autocomplete="off"/>
        </div>
    </div>


    <input class="button btn-danger" id="reg-btn" type="submit" value="申请提取现货" style="background: #e54245;">

    
<!-- 
    <form style="position:relative;border-bottom: 1px dashed #dedede;" action="{:url('contract/change')}" id="login-wrap" method="get">

        <input class="sous" type="submit" value="搜索" style="position: absolute; bottom:15%;right: 25%;width: 45px;text-align: center;height: 25px;    border-radius: 5px;color: #fff;box-shadow: 1px 1px 2px #907777; background: #b95f5f;">
    </form> 
    
    </script>-->
    <script>
        $('#reg-btn').click(function(){
            
            var password    = $('input[type="password"]').val();
            var number      = $('input[type="number"]').val();
            var hidden      = $('input[type="hidden"]').val();
            var accuser      = $('#accuser').val();
            var accmobile      = $('#accmobile').val();
            var address      = $('#address').val();
             var goods_id      = $('#goods_id').val();
             
            $.ajax({
                url : '{:url("user/commit_use")}',
                data : {number:number,goods_id:goods_id,address:address,accuser:accuser,accmobile:accmobile,token:hidden},
                type : 'post',
                success:function(d){
                    if(d.error){
                        $.toast(d.error, "forbidden");
                        if(d.url){
                            setTimeout(function (){
                                window.location.href = d.url;
                            },1000);
                        }
                    }else if(d.success){
                        $.toast(d.success);
                        setTimeout(function (){
                            window.location.href = "/mobile/user/use_pay";
                        },1000);
                    }
                }
            });

        });
    </script>
    
{/block}